package org.jaychan.live.user.provider.rpc;

import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;
import org.jaychan.live.user.dto.UserDTO;
import org.jaychan.live.user.interfaces.IUserRpc;
import org.jaychan.live.user.provider.service.IUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.Map;


@DubboService
//@DubboService(group = "jay-test-1")
// 假如说有多个服务，配置了这个组，在配置文件中配置了多个服务，可以用group来区分。同时TestController中的@DubboReference注解里面的group也要改过来，还有个更细粒度的，version，还可以指定不同的负载均衡策略
public class UserRpcImpl implements IUserRpc {
    private static final Logger LOGGER = LoggerFactory.getLogger(UserRpcImpl.class);

    @Resource
    private IUserService userService;

    @Override
    public UserDTO getByUserid(Long userId) {
        return userService.getByUserid(userId);
    }

    @Override
    public boolean updateUserInfo(UserDTO userDTO) {
        return userService.updateUserInfo(userDTO);
    }

    @Override
    public boolean insertOne(UserDTO userDTO) {
        return userService.insertOne(userDTO);
    }

    @Override
    public Map<Long, UserDTO> batchQueryUserInfo(List<Long> userId) {
        return userService.batchQueryUserInfo(userId);
    }
}
